<template>
  <div class="aside">
    <!-- router:是否启用 vue-router 模式。 
     启用该模式会在激活导航时以 index 作为 path 进行路由跳转 
     使用 default-active 来设置加载时的激活项 -->
    <el-menu
      :default-active="route.path"
      class="el-menu-vertical-demo"
      :collapse="commonStore.isCollapse"
      style="border: none"
      router
    >
      <el-menu-item index="/mainBox/index">
        <el-icon><HomeFilled /></el-icon>
        <span>首页</span>
      </el-menu-item>

      <el-menu-item index="/mainBox/user">
        <el-icon><Avatar /></el-icon>
        <span>个人中心</span>
      </el-menu-item>

      <el-sub-menu index="/mainBox/myBlog" >
        <template #title>
          <el-icon><List /></el-icon>
          <span>博客管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/mainBox/myBlog/addBlog">添加博客</el-menu-item>
          <el-menu-item index="/mainBox/myBlog/getBlog">博客列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>


      <el-sub-menu index="/mainBox/userManage">
        <template #title>
          <el-icon><UserFilled /></el-icon>
          <span>用户管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/mainBox/userManage/addUser">添加用户</el-menu-item>
          <el-menu-item index="/mainBox/userManage/getUser">用户列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
    </el-menu>
  </div>
</template>
<script name="aside" setup>
import { HomeFilled, Avatar, List, UserFilled} from "@element-plus/icons-vue";
import { useCommonStore } from "@/store/common";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router=useRouter()
const commonStore = useCommonStore();
</script>

<style></style>
